<template>
  <div class="project-show-box basic-from">
    <v-dialog title="查看" :show.sync="dialogVisible" width="1200px" @beforeClose="beforeClose" :close-on-click-modal="false">
      <div class="card-title">工程信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="工程名称" prop="projectName">
          <span class="int-text">{{showForm.projectName}}</span>
        </el-form-item>
        <el-form-item label="工程地址" prop="projectAddress">
          <span class="int-text">{{showForm.projectAddress}}</span>
        </el-form-item>
        <el-form-item label="工程类型" prop="projectType">
          <span class="int-text">{{getCardTypeValue(showForm.projectType,projectTypes)}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">项目建议书信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="文号" prop="proposalDocument">
          <span class="int-text">{{showForm.proposalDocument}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="proposalAmount">
          <span class="int-text">{{showForm.proposalAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="审批日期" prop="proposalApprove">
          <span class="int-text">{{showForm.proposalApprove}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">可行性研究报告信息</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="文号" prop="feasibleDocument">
          <span class="int-text">{{showForm.feasibleDocument}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="feasibleAmount">
          <span class="int-text">{{showForm.feasibleAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="审批日期" prop="feasibleApprove">
          <span class="int-text">{{showForm.feasibleApprove}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">概算批复文件</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="文号" prop="estimateDocument">
          <span class="int-text">{{showForm.estimateDocument}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="estimateAmount">
          <span class="int-text">{{showForm.estimateAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="审批日期" prop="estimateApprove">
          <span class="int-text">{{showForm.estimateApprove}}</span>
        </el-form-item>
      </el-form>
      <div class="card-title">预算审核文件</div>
      <el-form ref="editForm" :model="showForm" class="form-wrap" size="small" label-position="top">
        <el-form-item label="文号" prop="budgetDocument">
          <span class="int-text">{{showForm.budgetDocument}}</span>
        </el-form-item>
        <el-form-item label="金额(元)" prop="budgetAmount">
          <span class="int-text">{{showForm.budgetAmount | thousandMoney}}</span>
        </el-form-item>
        <el-form-item label="审批日期" prop="budgetApprove">
          <span class="int-text">{{showForm.budgetApprove}}</span>
        </el-form-item>
      </el-form>

      <div class="card-title">附件</div>
      <div class="handling-opinions">
        <v-upload
          ref="informationUpload"
          :busId="showForm.projectSetupId"
          modelType="registration"
          isShowFileList
          :isView="true"
          multiple
          v-model="fileList"
        />
      </div>
      <span slot="foot">
        <el-button @click="$bus.$emit('operationLog', showForm.projectId)">操作日志</el-button>
        <el-button type="primary" @click="shutDown()">关闭</el-button>
      </span>
    </v-dialog>
  </div>
</template>

<script>
import { get } from '../api/information'
export default {
  name: "show-actual",
  mounted () {
    this.projectTypes = this.getDict("epc_project_type")
  },
  data () {
    return {
      dialogVisible: false,
      fileList: [],
      projectTypes: [],
      showForm: {
        projectSetupId: '',
        projectName: '',
        projectAddress: '',
        projectType: '',
        proposalDocument: '',
        proposalAmount: '',
        proposalApprove: '',
        feasibleDocument: '',
        feasibleAmount: '',
        feasibleApprove: '',
        estimateDocument: '',
        estimateAmount: '',
        estimateApprove: '',
        budgetDocument: '',
        budgetAmount: '',
        budgetApprove: ''
      }
    }
  },
  methods: {
    //打开弹框
    show (item) {
      this.dialogVisible = true
      if (item) {
        this.showForm.projectSetupId = item
        get(item).then(res => {
          if (res.data.code === 0 && res.data.data.epcProjectSetup !== null) {
            this.showForm = res.data.data.epcProjectSetup
          } else {
            this.$message.warning('暂未获取到数据！')
          }
        })
      }
    },
    //关闭弹框
    beforeClose (done) {
      this.$emit('beforeClose')
    },
    shutDown () {
      this.$emit('handleClose')
      this.dialogVisible = false
    },
    //对应value取label
    getCardTypeValue (num, sum) {
      let arr = sum.filter(e => e.value === num)
      if (arr.length > 0) {
        return arr[0].label
      } else {
        return num
      }
    }
  }
}
</script>

<style scoped lang="scss">
.card-box {
  min-height: 55px;
  .handling-opinions {
    padding: 20px;
  }
  .int-text {
    color: #999;
  }
}
</style>
